package com.aerozhonghuan.logisticsmall.framework.hybrid;

import android.support.annotation.NonNull;

import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.CloseWindowActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.EventNotificationActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.GetHostActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.GoPageActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.HideNavBarActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.HideProgressActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.JumpToHistoryActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.LocationActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.LogoutActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.OpenNewWindowActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.ScreenshotActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.ShowNavBarActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.ShowProgressActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.TimePickerActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.UmengEventActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.WeChatShareActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.actions.ZhonghuanEventActionHandler;
import com.aerozhonghuan.logisticsmall.framework.hybrid.bean.JsMobileAgentConstants;


/**
 * 描述
 * 作者 Zhang Yonghui
 * 创建日期 2019/1/20
 */
public class JsMobileAgentFactory {
    private JsMobileAgentFactory() {
    }

    @NonNull
    public static SimpleActionHandler createActionHandler(String actionFlag, NewWebviewFragment webviewFragment) {
        switch (actionFlag) {
            case JsMobileAgentConstants.FLAG_CLOSEWINDOW:
                return new CloseWindowActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_WECHATSHARE:
                return new WeChatShareActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_OPENNEWWINDOW:
                return new OpenNewWindowActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_GOPAGE:
                return new GoPageActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_UMENGEVENT:
                return new UmengEventActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_ZHONGHUANEVENT:
                return new ZhonghuanEventActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_LOGOUT:
                return new LogoutActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_SCREENSHOT:
                return new ScreenshotActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_SHOWTIMEPICKER:
                return new TimePickerActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_HIDE_NAVBAR:
                return new HideNavBarActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_SHOW_NAVBAR:
                return new ShowNavBarActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_JUMPTOHISTORY:
                return new JumpToHistoryActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_LOCATION:
                return new LocationActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_GETHOST:
                return new GetHostActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_SHOWPROGRESS:
                return new ShowProgressActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_HIDEPROGRESS:
                return new HideProgressActionHandler(webviewFragment);
            case JsMobileAgentConstants.FLAG_EVENTNOTIFICATION:
                return new EventNotificationActionHandler(webviewFragment);
            default:
                return null;
        }
    }
}
